262995
@@ -118,6 +118,9 @@
public class CombinedConfiguration extends HierarchicalConfiguration implements
     /** Constant for the default node combiner. */
     private static final NodeCombiner DEFAULT_COMBINER = new UnionCombiner();
 
+    /** Constant for the name of the property used for the reload check.*/
+    private static final String PROP_RELOAD_CHECK = "CombinedConfigurationReloadCheck";
+
     /** Stores the combiner. */
     private NodeCombiner nodeCombiner;
 
@@ -130,6 +133,9 @@
public class CombinedConfiguration extends HierarchicalConfiguration implements
     /** Stores a map with the named configurations. */
     private Map namedConfigurations;
 
+    /** A flag whether an enhanced reload check is to be performed.*/
+    private boolean forceReloadCheck;
+
     /**
      * Creates a new instance of <code>CombinedConfiguration</code> and
      * initializes the combiner to be used.
@@ -185,6 +191,34 @@
public class CombinedConfiguration extends HierarchicalConfiguration implements
         invalidate();
     }
 
+    /**
+     * Returns a flag whether an enhanced reload check must be performed.
+     *
+     * @return the force reload check flag
+     * @since 1.4
+     */
+    public boolean isForceReloadCheck()
+    {
+        return forceReloadCheck;
+    }
+
+    /**
+     * Sets the force reload check flag. If this flag is set, each property
+     * access on this configuration will cause a reload check on the contained
+     * configurations. This is a workaround for a problem with some reload
+     * implementations that only check if a reload is required when they are
+     * triggered. Per default this mode is disabled. If the force reload check
+     * flag is set to <b>true</b>, accessing properties will be less
+     * performant, but reloads on contained configurations will be detected.
+     *
+     * @param forceReloadCheck the value of the flag
+     * @since 1.4
+     */
+    public void setForceReloadCheck(boolean forceReloadCheck)
+    {
+        this.forceReloadCheck = forceReloadCheck;
+    }
+
     /**
      * Adds a new configuration to this combined configuration. It is possible
      * (but not mandatory) to give the new configuration a name. This name must
@@ -443,6 +477,40 @@
public class CombinedConfiguration extends HierarchicalConfiguration implements
         return copy;
     }
 
+    /**
+     * Returns the value of the specified property. This implementation
+     * evaluates the <em>force reload check</em> flag. If it is set, all
+     * contained configurations will be triggered before the value of the
+     * requested property is retrieved.
+     *
+     * @param key the key of the desired property
+     * @return the value of this property
+     * @since 1.4
+     */
+    public Object getProperty(String key)
+    {
+        if (isForceReloadCheck())
+        {
+            for (Iterator it = configurations.iterator(); it.hasNext();)
+            {
+                try
+                {
+                    // simply retrieve a property; this is enough for
+                    // triggering a reload
+                    ((ConfigData) it.next()).getConfiguration().getProperty(
+                            PROP_RELOAD_CHECK);
+                }
+                catch (Exception ex)
+                {
+                    // ignore all exceptions, e.g. missing property exceptions
+                    ;
+                }
+            }
+        }
+
+        return super.getProperty(key);
+    }
+
     /**
      * Creates the root node of this combined configuration.
      *
